<template>
  <el-container class="home-container">
    <el-aside class="side-bar" :width="isCollapse ? '64px' : '200px'">
      <div class="logo">
        <img src="../../assets/logo.png" alt="" />
        <span>电商后台管理系统</span>
      </div>
      <tree-menu :collapse="isCollapse"></tree-menu>
    </el-aside>
    <el-container>
      <el-header class="header">
        <div class="header-container">
          <div class="left">
            <div class="bread-crumb" @click="handleCollapse">
              <i v-if="isCollapse" class="el-icons el-icon-s-fold"></i>
              <i v-else class="el-icons el-icon-s-unfold"></i>
            </div>
            <el-breadcrumb separator-class="el-icon-arrow-right">
              <el-breadcrumb-item :to="{ path: '/home' }">首页</el-breadcrumb-item>
              <el-breadcrumb-item>活动管理</el-breadcrumb-item>
              <el-breadcrumb-item>活动列表</el-breadcrumb-item>
            </el-breadcrumb>
          </div>
        </div>
      </el-header>
      <el-main>
        <!-- 路由占位符 -->
        <router-view></router-view>
      </el-main>
    </el-container>
  </el-container>
</template>

<script>
import treeMenu from './tree-menu.vue'
export default {
  name: 'Home',
  components: { treeMenu },
  data() {
    return {
      isCollapse: false,
    }
  },
  methods: {
    handleCollapse() {
      this.isCollapse = !this.isCollapse
    },
  },
}
</script>

<style lang="less" scope>
.home-container {
  height: 100%;
  .side-bar {
    height: 100%;
    overflow: hidden;
    background-color: #2b2f3a;
    .logo {
      display: flex;
      align-items: center;
      height: 50px;
      img {
        margin: 0 16px;
        height: 32px;
        width: 32px;
      }
      span {
        color: #fff;
      }
    }
  }
  .el-container {
    height: 100%;
    .header {
      height: 50px !important;
      box-shadow: 0 2px 3px -1px #d2d2d2;
      background-color: #fff;
      .header-container {
        display: flex;
        align-items: center;
        justify-content: space-between;
        height: 100%;
        .left {
          display: flex;
          align-items: center;
          height: 100%;
          .bread-crumb {
            display: flex;
            align-items: center;
            height: 100%;
            .el-icons {
              font-size: 32px;
              cursor: pointer;
            }
          }
        }
      }
    }
    .el-main {
      height: 100%;
      background-color: #f5f6f7;
    }
  }
}
</style>
